package com.wc.alorithm_luogu.P3374;

import java.io.*;

/**
 * @Author congege
 * @Description 树状数组模板
 * https://www.luogu.com.cn/problem/P3374
 * @Date Created in 2023/12/6-9:19
 */
public class Main {
    static int maxN = 5 * (int) 1e5;
    static int[] array;
    static int[] lowBits;
    static int[] treeArray;
    static int n;

    private static StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    private static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

    public static void main(String[] args) {
        n = nextInt();
        int m = nextInt();
        array = new int[n + 1];
        lowBits = new int[n + 1];
        treeArray = new int[n + 1];
        for (int i = 1; i <= n; i++) {
            array[i] = nextInt();
            lowBits[i] = (-i) & i;
        }
        for (int i = 1; i <= n; i++) {
            add(i, array[i]);
        }

        while (m-- > 0) {
            int op = nextInt();
            int x = nextInt();
            int y = nextInt();
            if (op == 1) {
                add(x, y);
            } else {
                out.println(sectionSum(x, y));
            }
        }
        out.flush();
    }

    public static void add(int i, int val) {
        for (; i <= n; i += lowBits[i]) {
            treeArray[i] += val;
        }
    }

    // 求前缀和
    public static int preSum(int i) {
        int res = 0;

        for (; i > 0; i -= lowBits[i]) {
            res += treeArray[i];
        }
        return res;
    }

    public static int sectionSum(int l, int r) {
        return preSum(r) - preSum(l - 1);
    }

    public static int nextInt() {
        try {
            in.nextToken();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return (int) in.nval;
    }
}
